import { ConfigVO } from '@/api/interface/system/config'
import http from '@/api'
/**
 * @name 根据参数键名查询参数值
 * @param ossConfigId ossConfigId
 * @returns returns
 */
export const getConfigKeyApi = (configKey: string) => {
  return http.get<ConfigVO>(`/system/config/configKey/${configKey}`)
}
/**
 * @name 查询参数配置列表
 * @param query 参数
 * @returns 返回列表
 */
export const listConfigApi = (query: any) => {
  return http.get<any>('/system/config/list', query, { loading: true })
}

/**
 * @name 查询参数配置详细
 * @param configId configId
 * @returns returns
 */
export const getConfigApi = (configId: any) => {
  return http.get<any>(`/system/config/${configId}`)
}

/**
 * @name 新增参数配置
 * @param data data
 * @returns returns
 */
export const addConfigApi = (data: any) => {
  return http.post<any>('/system/config', data, { loading: false })
}

/**
 * @name 修改参数配置
 * @param data data
 * @returns returns
 */
export const updateConfigApi = (data: any) => {
  return http.put<any>('/system/config', data, { loading: false })
}
/**
 * @name 修改参数配置
 * @param data data
 * @returns returns
 */
export const updateConfigByKeyApi = (data: any) => {
  return http.put<any>('/system/config/updateByKey', data, { loading: false })
}

/**
 * @name 删除参数配置
 * @param configId configId
 * @returns returns
 */
export const delConfigApi = (configId: any) => {
  return http.delete<any>(`/system/config/${configId}`)
}

/**
 * @name 刷新参数缓存
 * @returns returns
 */
export const refreshCacheApi = () => {
  return http.delete<any>(`/system/config/refreshCache`)
}

/**
 * @name 导出数据
 * @returns returns
 */
export const exportConfigApi = (data: any) => {
  return http.downloadPost('/system/config/export', data)
}
